#! /usr/bin/env python # V/HBL Python Menu # by Acid_Snake changelog = """ Version 0.1: Initial release Version 0.1.1: EBOOT.PBP is now renamed to wmenu.bin Version 0.2: Added possibility to view icon0.png Added ability to have 10 more backgrounds named bgx.png (where x is a number from 0 to 9) Cleared some unused code Version 0.2.1: Fixed some bugs Sped up icon0.png loading by extracting them once Version 0.2.2: Custom backgrounds can now be in .jpg format Fixed bug that crashed the menu if exiting after viewing help within game menu Added pyMenu version in help menu Version 0.2.2.1: Removed unused modules Fix bug in PSVita Added compatibility with Motorstorm Version 0.3: Added a log.txt file for python tracebacks Finished the file manager Fixed constant MS reading problem Added code to look for and remove homebrews starting with __sce__ or _sce_ Created a complete version of the menu, being toggled on/off with square button (in main menu) Cleaned some code Created API for easier coding Re-structured the entire code Made pyMenu more expandible """ log = open("log.txt","w") log.write("program started\n") log.close() try: from config import * except: pass #import common, icon, img, menu, psptools, unzip from define import * from common import * from icon import * from img import * from menu import * from psptools import * from unzip import * from savedata import * from browser import * from game import * from imports import imports from api import api from picture import * #from music import * import traceback for i in imports: exec "import "+imports[i] def menu_simple(): def go(): reload(define) reload(menu) if menu.get() == "Savedata": save_convert() menu_simple() elif menu.get() == "Game": if game_menu == "plain": game_select() elif game_menu == "icon": game_select_icon() else: game_select_icon() menu_simple() elif menu.get() == "Browser": root, dirs, files = os.walk(start_path).next() browse = dirs+files if browse == []: browse = [""] browser_menu().file_browser(browse, root) reload(define) # Dirty fix :P menu_simple() elif menu.get() == "PSP Tools": psptools().menu() menu_simple() else: exec imports[menu.get()]+".main()" in globals() menu_simple() options = [ "Game", "Savedata", "Browser", "PSP Tools" ] for i in imports: options = options.__add__([i]) opt_pos = 1 img3.blit(img) menu = simple_menu() menu.init(options) x4 = True while x4 == True: delay() pad = psp2d.Controller() if pad.down: menu.down() elif pad.up: menu.up() elif pad.cross: x4 = False img_clear() go() elif pad.circle: x4 = False file1 = open("ms0:/path.txt","w") file1.write("quit\n") file1.close() msg("Exiting...") raise SystemExit elif pad.select: x4 = False help("menu_adv") elif pad.square: x4 = False menu_adv() def menu_adv(): def go(): reload(define) if menu.get() == "Savedata": save_convert_adv() menu_adv() elif menu.get() == "Game": if game_menu == "plain": game_select_adv() elif game_menu == "icon": game_select_icon_adv() else: game_select_icon_adv() menu_adv() elif menu.get() == "Browser": root, dirs, files = os.walk(start_path).next() browse = dirs+files if browse == []: browse = [""] browser_menu().file_browser(browse, root) reload(define) # Dirty fix :P menu_adv() elif menu.get() == "PSP Tools": psptools().menu() menu_adv() elif menu.get() == "Picture Viewer": pic_menu() menu_adv() #elif menu.get() == "Music Player": # music_menu() # menu_adv() else: exec imports[menu.get()]+".main()" in globals() menu_adv() options = [ "Game", "Savedata", "Browser", "PSP Tools", "Picture Viewer", #"Music Player" ] for i in imports: options = options.__add__([i]) opt_pos = 1 img3.blit(img) menu = adv_menu() menu.init(options) x4 = True while x4 == True: delay() pad = psp2d.Controller() if pad.down: menu.down() elif pad.up: menu.up() elif pad.cross: x4 = False go() elif pad.circle: x4 = False file1 = open("ms0:/path.txt","w") file1.write("quit\n") file1.close() msg("Exiting...") raise SystemExit elif pad.select: x4 = False help("menu_adv") elif pad.square: x4 = False menu_simple() if api == False: show_loading() check_icons() if main_menu == "complete": menu_adv() elif main_menu == "simple": menu_simple() else: menu_adv() elif api == True: print "pyMenu API loaded"